<?php


namespace app\cms\community\thirdPartyApi\payPal\lib;


use app\cms\community\thirdPartyApi\abstracts\Config;

class publicParams extends Config
{

    public string $intent = "CAPTURE";
    public string $referenceId = "test_ref_id1";
    public array $amount = [
        "value" => 1.00, //金额
        "currency_code" => "USD" //币种
    ];

    // orderId JSAPI
    public string $orderID;

    public bool $sandbox = true;

    public array $application_context = [
        'cancel_url' => '', // 取消支付
        'return_url' => '' // 支付成功
    ];

    public function __construct(int $type = 0, int $id = 0) {
        parent::__construct($type, $id);
        $this->application_context = [
            'cancel_url' => $this->config['cancel_url'] ?? '', // 取消支付
            'return_url' => $this->config['return_url'] ?? '' // 支付成功
        ];
    }

    /**
     * @param string $orderID
     * @return static
     */
    public function setOrderID(string $orderID): static
    {
        $this->orderID = $orderID;
        return $this;
    }
}